﻿//*************************************************************************************************
// SIMPLE ROGUE 01
// + CREATE A ROOM AND A HERO
//*************************************************************************************************
using System;

namespace SimpleRogue
{
    public class SimpleRogue_01
    {
        // ****************************************************************************************
        // variables
        // ****************************************************************************************
        //Hero Stuff
        public static int HeroLocationX = 40;
        public static int HeroLocationY = 10;

        //Room Size
        public static int RoomWidth = 100;
        public static int RoomHeight = 50;
        //array to hold the game map and it's characters
        public static string[,] GameMap = new string[RoomWidth, RoomHeight];


        // ****************************************************************************************
        // MAIN (start)
        // ****************************************************************************************
        public static void Run_Rogue_01()
        {

            //Randomize Object
            Random objRandom = new Random();

            //Hide Cursor
            Console.CursorVisible = false;

            //-------------------------------------------------------------------------------------
            // Room size detials
            //-------------------------------------------------------------------------------------
            //Mapsize (Buffer)
            Console.BufferWidth = RoomWidth;
            Console.BufferHeight = RoomHeight;
            //Mapsize (Console Window)
            Console.WindowWidth = RoomWidth;
            Console.WindowHeight = RoomHeight;
            //Console.TreatControlCAsInput = true;            

            //-------------------------------------------------------------------------------------
            // Create one giant room -- values are placed in the array
            //-------------------------------------------------------------------------------------
            //Set all array elements to blank (ie, make each tile empty)
            for (int x = 0; x < RoomWidth - 0; x++)
            {
                for (int y = 0; y < RoomHeight - 0; y++)
                    GameMap[x, y] = " ";
            }

            //-------------------------------------------------------------------------------------
            //DISPLAY MAP - aka write it out to the screen
            //-------------------------------------------------------------------------------------
            for (int x = 2; x < RoomWidth - 2; ++x)
            {
                for (int y = 2; y < RoomHeight - 2; ++y)
                {
                    Console.SetCursorPosition(x, y);
                    Console.Write(GameMap[x, y]);
                }
            }

            //-------------------------------------------------------------------------------------
            // Major Loop (loop the game)
            // This is where all the action takes place
            //-------------------------------------------------------------------------------------
            while (true)
            {
                //Draw Current HeroPosition, represented by an @ symbol (in yellow)
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.SetCursorPosition(HeroLocationX, HeroLocationY);
                Console.Write('@');
                Console.ForegroundColor = ConsoleColor.White;
            }            
        }
    }
}
